#ifndef _LNBINTREE_H_
#define _LNBINTREE_H_

#include <stdio.h>
#include <stdlib.h>
#include "declare.h"

#define EMPTYELEM '#'
#define BinTreeNode int

struct seqBinTree {
    int MAXNUM;
    int n;
    ELEMTYPE *nodes;
};

typedef struct seqBinTree *PSQBinTree;

PSQBinTree createEmptyBinTree(int num);
int constructBinTree(PSQBinTree t, ELEMTYPE * elemList);
int isNULL(PSQBinTree t);
BinTreeNode root(PSQBinTree t);
BinTreeNode parent(PSQBinTree t, BinTreeNode c);
BinTreeNode leftChild(PSQBinTree t, BinTreeNode p);
BinTreeNode rightChild(PSQBinTree t, BinTreeNode p);
int print(PSQBinTree t);
void preOrder(PSQBinTree t);
void inOrder(PSQBinTree t);
void postOrder(PSQBinTree t);
void levelOrder(PSQBinTree t);
int visit(PSQBinTree t, BinTreeNode p);
int destroyBinTree(PSQBinTree t);
#endif
